<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <script src="/js/jquery.min.js"></script>
  <title>系统设置</title>
  <style>
	*{padding:0;margin:0;}
	
	html{
		font-family:"微软雅黑";
		font-size:20px;
		color:#303030;
	}
	a{
		
		text-decoration:none;
		-webkit-tap-highlight-color:rgba(255,0,0,0);
	
	}
	a:link{color:#666;}
	a:visited{color:#666;}
	a:hover{color:#666;}
	a:active{color:#23D1F5;}
	.sys_set{
		width:16rem;

	}
	.sys_set .text_first{
		display:block;
		color:#303030;
	}
	.sys_set p,.sys_set .text_first{
		width:14rem;
		margin:1rem auto;
		padding-bottom:1rem;
		font-size:.7rem;
		position:relative;
		border-bottom:2px solid #ccc;
		
	}
	.sys_set p > a{
		position:absolute;
		right:0;
		color:#23D1F5;
	}
	.sys_set a > img{
		position:absolute;
		right:0;
		width:3%;}
	
	.footer_btns {
		width:12.1rem;
		position:absolute;
		left:0;
		right:0;
		margin:auto;
		bottom:2rem;
		border:1px solid #303030;
		border-radius:5rem;
	}
	.footer_btns a{
		display:block;
		width:6rem;
		float:left;
		font-size:.8rem;
		text-align:center;
		padding:.5rem 0;

	}
	.footer_btns a:nth-of-type(1){
		border-right:1px solid #303030;
		
	}
.cutuser_bg,.undbing_bg{
	width:16rem;
	background: rgba(0,0,0,.5);
	position: absolute;
	top: 0;
	left: 0;
	z-index: 10000;
	display: none;
	font-size: .8rem;
}
	.undbing_bg .undbing_box{
		width: 10rem;
		height: 6rem;
		background: #fff;
		position: absolute;
		text-align: center;
		border-radius: .5rem;
		top: 0;
		left: 0;
		right: 0;
		bottom:0;
		margin:auto;
	}
	.undbing_bg .undbing_box p{
		margin-top: 1rem;
	}
	.undbing_bg .undbing_box section{
		margin: 1rem .4rem;
    	width: 4rem;
    	float: left;
    	padding: .3rem 0;
    	border-radius: .3rem;
    	border: 1px solid #ccc;
	}
	.hint_bg{
		width:16rem;
		background: rgba(0,0,0,.5);
		position: absolute;
		top: 0;
		left: 0;
		z-index: 100000000;
		display: none;
		font-size: .8rem;
	}
	.hint_box{
		width: 10rem;
		height: 6rem;
		background: #fff;
		position: absolute;
		text-align: center;
		border-radius: .5rem;
		top: 0;
		left: 0;
		right: 0;
		bottom:0;
		margin:auto;
	}
	.hint_bg .hint_box p{
		margin-top: 1rem;
	}
	.hint_bg .hint_box section{
		width:5rem;
		margin:1.2rem auto; 
		border:1px solid #ccc;
		padding: .3rem 0;
		border-radius:.3rem;
	}
  </style>
 </head>
 <body>
	<input type="hidden" value="{{ $status['message'] or '' }}" class="hint_infor" />
	<section class="sys_set">
		<a class="text_first" href="/user/info">个人信息<img src="/img/to_more.png" /></a>
		<a class="text_first" href="/device/info">设备信息<img src="/img/to_more.png" /></a>
		<p>设备型号<a>wifi标准版</a></p>
		<p>设备厂家<a href="http://www.konka.com/index.php">康佳科技</a></p>
	</section>
	<section class="footer_btns">
		<a href="/device/index">返回</a>
		<a class="unbundling">解绑设备</a>
	</section>
	<section class="undbing_bg">
		<section class="undbing_box">
			<p>确定要解绑当前设备吗？</p>
			<section class="cance_btn" >取消</section>
			<section class="ok_btn">确定</section>
		</section>
	</section>
	<!-- 提交信息服务器反馈信息-->
	<section class="hint_bg">
		<section class="hint_box">
			<p class="hint_text"></p>
			<section class="hint_btn">确定</section>
		</section>
	</section>
	<script src="/js/publick.js"></script>
 </body>
</html>
<script>
	$(function(){
		var hint_data = $('.hint_infor').val();
		hint(hint_data);
		$('.unbundling').unbind('click').click(function(){
			var _this = $(this);
			$('.undbing_bg').css("display","block");
			$('.undbing_bg').css("height",$(window).height()+"px");
			//点击弹出框"取消"按钮
			$('.cance_btn').click(function(){
				$('.undbing_bg').css("display","none");
			});
			//点击弹出框"确定"按钮
			$('.ok_btn').unbind('click').click(function(){
				$('.undbing_bg').css("display","none");
				sendfn();			
			})		
		});
		function sendfn(){
		$.ajax({
			url:'/api/device/unbind-current',
			type:'post',
			dataType:"json",
			success:function(data){
				if(data.status.errCode == 0){
					hint('解绑成功');
					if(data.data.newDeviceCode == null){
						window.location.href = '/device';
					}
				}else if(data.status.errCode == 2004){
					window.location = "/device";
					hint(data.status.message);
				}else{
					hint(data.status.message);
				}

			}
		});
	}
	});
</script>
